package SQL::Builder::UseIndex;

use warnings;
use strict;

use SQL::Builder::Base;
use SQL::Builder::List;
use base qw(SQL::Builder::List);

sub init {
      my $self = shift;
      
      $self->SUPER::init();
      
      return $self
}

sub table       { return shift->_set('table', @_) }
sub force       { return shift->_set('force', @_) }
sub expr 	{ return shift->_set('expr',  @_) }


sub sql	{
      my $self = shift;
      my $sql  = $self->dosql($self->expr);
      return "" unless defined ($sql) && length $sql;
      
      if ($self->force) {
            return "FORCE INDEX ($sql)";      
      } else {
            return "USE INDEX ($sql)"
      }
      
}

1;

=head1 NAME

SQL::Builder::UseIndex - MySQL USE INDEX() hint

=head1 SYNOPSIS

=head1 DESCRIPTION

=head1 METHODS

=head1 SEE ALSO

SQL::Builder::Hints(3)
